package org.chen.aao.common.user.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;

@Data
@TableName("users")
public class User {
    @TableId(type = IdType.AUTO)
    private Long id;
    
    private String email;
    private String username;
    private String passwordHash;
    private String avatarUrl;
    private String status; // ACTIVE, INACTIVE, BANNED

    private Boolean emailVerified;  // 邮箱是否已验证
    private LocalDateTime emailVerifiedAt;  // 邮箱验证时间
    private LocalDateTime lastLoginAt;  // 最后登录时间
    private String lastLoginIp;  // 最后登录IP

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;
    
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;
}